#!/bin/bash

for i in `seq 1 1 40`
do
########## for unbound state: $10==0.000#########
 awk '$10==0.000 {sum+=$7;count++}END{print sum/count}' k$i.dat>> alpha1.dat
 awk '$10==0.000 {sum+=$8;count++}END{print sum/count}' k$i.dat>> alpha2.dat
 awk '$10==0.000 {sum+=$9;count++}END{print sum/count}' k$i.dat>> Betas.dat
done
 r1=`cat alpha1.dat|awk '{sum+=$1;count++}END{print sum/count}'`
 r3=`cat alpha2.dat|awk '{sum+=$1;count++}END{print sum/count}'`
 r2=`cat Betas.dat|awk '{sum+=$1;count++}END{print sum/count}'`
rm alpha1.dat alpha2.dat Betas.dat
  echo $r1 $r3 $r2
